package com.biluo.comman;

import java.io.*;
import java.util.Properties;

public class DaoruBookCount {

	
	
	
	 /*********************************************************/
    /**
     * @param args
     */

    public static int setCount(String value,String path) {
    	String key = "count";
        Properties properties = new Properties(); // ����Properties����
        properties.setProperty(key, value); // ���������ļ�ֵ
        try {
            File file = new File(path);
            FileOutputStream out = new FileOutputStream(file);// �������������
            properties.store(out, "bookcount"); // ����Ϣͨ����д�뵽�����ļ�
            out.close(); // �ر���
            return 1;
        } catch (Exception e) {
            e.printStackTrace();
            return -1;
        }
    }

    
    /*********************************************************/
    /**
     * @throws IOException 
     * @throws FileNotFoundException ****************************************************************/
    public static String getCount(String path) {
    	String key = "count";
    	Properties pps = new Properties();
        try {
            File file = new File(path);
            FileInputStream out = new FileInputStream(file);// �������������
			pps.load(out);
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}
        String count = pps.getProperty(key);
		return count;
        
    }



    /*********************************************************/
}
